]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
gdmUtil: Collect services that determine the username in one place
authorAlessandro Bono <alessandro.bono369@gmail.com>
Wed, 3 Aug 2022 13:08:07 +0000 (15:08 +0200)
committerMarge Bot <marge-bot@gnome.org>
Mon, 23 Jan 2023 20:37:46 +0000 (20:37 +0000)
Doing so, extensions don't need to reimplement entirely the
AuthPrompt.reset() function just for adding their own credential
service in the foreground service check.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2399>

js/gdm/authPrompt.js
js/gdm/util.js

index 3b1fa805ac2c248886f891e3c7d695bb2a902e7c..97b12ef54389080e733f4b97d69e96576f5b1aee 100644 (file)
@@ -7,8 +7,6 @@ const Animation = imports.ui.animation;
 const AuthList = imports.gdm.authList;
 const Batch = imports.gdm.batch;
 const GdmUtil = imports.gdm.util;
-const OVirt = imports.gdm.oVirt;
-const Vmware = imports.gdm.vmware;
 const Params = imports.misc.params;
 const ShellEntry = imports.ui.shellEntry;
 const UserWidget = imports.ui.userWidget;
@@ -630,9 +628,7 @@ var AuthPrompt = GObject.registerClass({
             if (oldStatus === AuthPromptStatus.VERIFICATION_CANCELLED)
                 return;
             beginRequestType = BeginRequestType.PROVIDE_USERNAME;
-        } else if (this._userVerifier.serviceIsForeground(OVirt.SERVICE_NAME) ||
-                   this._userVerifier.serviceIsForeground(Vmware.SERVICE_NAME) ||
-                   this._userVerifier.serviceIsForeground(GdmUtil.SMARTCARD_SERVICE_NAME)) {
+        } else if (this._userVerifier.foregroundServiceDeterminesUsername()) {
             // We don't need to know the username if the user preempted the login screen
             // with a smartcard or with preauthenticated oVirt credentials
             beginRequestType = BeginRequestType.DONT_PROVIDE_USERNAME;
index 43647e7ac959e57ec00dabf64e32c965f2d97294..1c2a40cd6e8b56e6631d051eeda035ca34df8b1d 100644 (file)
@@ -522,6 +522,15 @@ var ShellUserVerifier = class extends Signals.EventEmitter {
         return serviceName == this._getForegroundService();
     }
 
+    foregroundServiceDeterminesUsername() {
+        for (let serviceName in this._credentialManagers) {
+            if (this.serviceIsForeground(serviceName))
+                return true;
+        }
+
+        return this.serviceIsForeground(SMARTCARD_SERVICE_NAME);
+    }
+
     serviceIsDefault(serviceName) {
         return serviceName == this._defaultService;
     }